// export default {
//     created() {
//         //#ifdef MP-WEIXIN
//         wx.showShareMenu({
//             withShareTicket: true,
//             menus: ['shareAppMessage', 'shareTimeline']
//         });
//         //#endif
//     },
// }


export default {
	created() {
		//#ifdef MP-WEIXIN
		wx.showShareMenu({
			withShareTicket: true,
			menus: ["shareAppMessage", "shareTimeline"],
		});
		//#endif
	},
	onShareAppMessage: async (res) => {

		console.log("分享按钮回调2222222", res)
		let url = uni.getStorageSync("url")
		if (res.from == "menu") {
			var pages = getCurrentPages(); // 获取当前页面栈
			var currentPage = pages[pages.length - 1]; // 获取当前页面
			console.log(currentPage.$page.fullPath); // 当前页面的URL
			url = currentPage.$page.fullPath
		}
		// console.log("url11111111", url + "?" + uni.getStorageSync("scene"))
		// 发送给朋友
		return new Promise((resolve) => {
			setTimeout(() => {
				resolve({
					path: url + "?" + uni.getStorageSync("scene"),
					scene: uni.getStorageSync("scene")
				})
			}, 1000)
		})
	},
	onShareTimeline(res) {
		// 分享到朋友圈
		return {
			path: uni.getStorageSync("url") + "?" + uni.getStorageSync("scene"),
			scene: uni.getStorageSync("scene")
			// title: "your title",
			// imageUrl: "your image",
		};
	},
};